package cn.iocoder.yudao.module.project.dal.mysql.defectiveproductrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.defectiveproductrecord.DefectiveProductRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.defectiveproductrecord.vo.*;

/**
 * 不良品记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DefectiveProductRecordMapper extends BaseMapperX<DefectiveProductRecordDO> {

    default PageResult<DefectiveProductRecordDO> selectPage(DefectiveProductRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DefectiveProductRecordDO>()
                .eqIfPresent(DefectiveProductRecordDO::getOrderCode, reqVO.getOrderCode())
                .eqIfPresent(DefectiveProductRecordDO::getFlex, reqVO.getFlex())
                .eqIfPresent(DefectiveProductRecordDO::getOrderDetailId, reqVO.getOrderDetailId())
                .eqIfPresent(DefectiveProductRecordDO::getInternalCode, reqVO.getInternalCode())
                .eqIfPresent(DefectiveProductRecordDO::getDefectiveReason, reqVO.getDefectiveReason())
                .eqIfPresent(DefectiveProductRecordDO::getOperatorUser, reqVO.getOperatorUser())
                .betweenIfPresent(DefectiveProductRecordDO::getOperatorTime, reqVO.getOperatorTime())
                .betweenIfPresent(DefectiveProductRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DefectiveProductRecordDO::getId));
    }

}